<?php

namespace catchAdmin\pc\model;

use catcher\exceptions\AlertErrorException;

class Banner extends \catchAdmin\model\Banner
{

    public $name = 'banner';


    public function saveData($param)
    {
        if (empty($param['img'][0])) {
            throw new AlertErrorException('图片不能为空');
        }

        return $this->saveDataCC([
            'id'        => $param['id'] ?? 0,
            'title'     => $param['title'],
            'type'      => $param['type'],
            'from_date' => $param['from_date'] ?? '',
            'to_date'   => $param['to_date'] ?? '',
            'img'       => $param['img'][0],
        ]);
    }
}
